<%@ page contentType="text/html;charset=UTF-8" %>
<%@ taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core" %>
<%@ taglib prefix="fmt" uri="http://java.sun.com/jsp/jstl/fmt" %>
<%@ taglib prefix="fn" uri="http://java.sun.com/jsp/jstl/functions" %> 
<%@ taglib prefix="tags" tagdir="/WEB-INF/tags" %>
<%@taglib prefix="shiro" uri="http://shiro.apache.org/tags" %>
<c:set var="ctx" value="${pageContext.request.contextPath}"/>

<html>
<head>
	<title>用户管理</title>
	<link rel="stylesheet" href="${ctx}/static/css/jquery-ui.min.css" />
	<link rel="stylesheet" href="${ctx}/static/css/datepicker.css" />
	<script src="${ctx}/static/js/jquery-ui.min.js"></script>		
</head>

<body>	
	
	<div class="main-content-inner">
	
	    <script type="text/javascript">
			function froze(id){
				$.ajax({
					type:'get',
					url:'${ctx}/customor/frozencustomor',
					data:{'id':id},
					success:function(data) {    
				        console.log(data);
				        if(data=='1'){
							alert("冻结成功!");
							location.reload();
							return;
				        }else{
				        	alert("后台出现未知错误，请联系维护人员!");
				        	return;
				        }
					}
				});
			}
        </script>		
	
		<!-- #section:basics/content.breadcrumbs -->
		<div class="breadcrumbs" id="breadcrumbs">
			<script type="text/javascript">
				try{ace.settings.check('breadcrumbs' , 'fixed')}catch(e){}
			</script>
	
			<ul class="breadcrumb">
				<li>
					<i class="ace-icon fa fa-home home-icon"></i>
					<a href="${ctx}/welcome">主页</a>
				</li>
				<li class="active">用户</li>
			</ul><!-- /.breadcrumb -->
	
			<!-- #section:basics/content.searchbox -->
			<div class="nav-search" >
				<form class="form-search" action="${ctx}/customor/list" method="GET">
					<span class="input-icon">
						<span class="input-group">
							<input type="text" autocomplete="off" name="search_LIKE_user.name" placeholder="姓名 ..." class="nav-search-input" id="nav-search-input" autocomplete="off" value="${param['search_LIKE_user.name']}" />
<!-- 							<i class="ace-icon fa fa-search nav-search-icon" onclick="$('.form-search').submit();"></i> -->
						</span>
					</span>
					<span class="input-icon">
						<span class="input-group">				
							<input type="text" autocomplete="off" name="search_LIKE_user.mobile" placeholder="电话 ..." class="nav-search-input" id="nav-search-input" autocomplete="off" value="${param['search_LIKE_user.mobile']}" />
<!-- 							<i class="ace-icon fa fa-search nav-search-icon" onclick="$('.form-search').submit();"></i> -->
						</span>
					</span>
   			       <span class="input-icon">
						<span class="input-daterange input-group">
							用户积分：
						</span>
					</span>
					<span class="input-icon">
						<span class="input-group">								
							<input type="text" autocomplete="off" name="search_GTE_integration" class="nav-search-input" id="nav-search-input" autocomplete="off" value="${param['search_GTE_integration']}" />
<!-- 							<i class="ace-icon fa fa-search nav-search-icon" onclick="$('.form-search').submit();"></i> -->
						</span>
					</span>
					<span class="input-icon">
						<span class="input-group">								
							<input type="text" autocomplete="off" name="search_LTE_integration" class="nav-search-input" id="nav-search-input" autocomplete="off" value="${param['search_LTE_integration']}" />
<!-- 							<i class="ace-icon fa fa-search nav-search-icon" onclick="$('.form-search').submit();"></i> -->
						</span>
					</span>
			</div>
				<div class="breadcrumbs" >
			   	 <div class="nav-search" id="nav-search" style="position: relative;left: 22px;">
					<span class="input-icon">
						<span class="input-daterange input-group">
							<input type="text" style="width:100px;" id="datetimeStart" class="input-sm form-control" name="search_GT_user.registerDate" value="${param['search_GT_user.registerDate']}" >
							<span class="input-group-addon">
								<i class="fa fa-exchange"></i> 
							</span>
							<input type="text" style="width:100px;" id="datetimeEnd" class="input-sm form-control" name="search_LTE_user.registerDate" value="${param['search_LTE_user.registerDate']}" >
						</span>
					</span>
					<span class="input-icon">
						<span class="input-group">	
							<input type="button" value="搜索" onclick = "dynamicSubmit('${ctx}/customor/list');" />
						</span>
					</span>	
					</form>
			</div><!-- /.nav-search -->

			<!-- /section:basics/content.searchbox -->
		</div>
		<!-- /section:basics/content.breadcrumbs -->
		
		<div class="page-content">
			
			<c:if test="${not empty message}">
				<div id="message" class="alert alert-success"><button data-dismiss="alert" class="close">×</button>${message}</div>
			</c:if>	
			
			<div class="page-header">
				<h1>
					用户
					<small>
						<i class="ace-icon fa fa-angle-double-right"></i>
						顾客列表
					</small>
				</h1>
				
			</div><!-- /.page-header -->			
			
			<div class="row">
				<div class="col-xs-12">
					<!-- PAGE CONTENT BEGINS -->
					
					<table id="sample-table-1" class="table table-striped table-bordered table-hover">
						<thead>
							<tr>
								<th class="center">
									<label class="position-relative">
										<input type="checkbox" id="id-toggle-all" class="ace" />
										<span class="lbl"></span>
									</label>
								</th>
								<th>姓名</th>
								<th>电话</th>
								<th>注册城市</th>
								<th>拥有积分</th>
								<th>用户状态</th>
								<th>创建时间</th>
								<th>管理</th>
							</tr>
						</thead>

						<tbody>
							<c:forEach items="${customors.content}" var="customor">
							<tr>
								<td class="center">
									<label class="position-relative">
										<input type="checkbox" class="ace" />
										<span class="lbl"></span>
									</label>
								</td>

								<td>
									${customor.user.name}
								</td>
								
								<td>
									${customor.user.mobile}
								</td>
								<td>
									${customor.shtCity.name}
								</td>
								<td>
									${customor.integration}
								</td>
								<td>
									<c:if test="${customor.status eq '0' }">正常</c:if>
									<c:if test="${customor.status eq '1' }">冻结</c:if>
								</td>
								<td>
									<fmt:formatDate value="${customor.user.registerDate}" pattern="yyyy-MM-dd  HH:mm:ss" />
								</td>
							</tr>
							</c:forEach>
						</tbody>
					</table>
				</div>
			</div>
			<tags:pagination page="${customors}" paginationSize="5"/>
		</div><!-- /.page-content -->
	</div>
	
	<script src="${ctx}/static/js/bootbox.min.js" type="text/javascript"></script>	
	<script src="${ctx}/static/js/date-time/bootstrap-datepicker.js"></script>
	<script type="text/javascript">
		$('.input-daterange').datepicker({
			format:'yyyy-mm-dd',
			autoclose:true
		});
		
			/**日期的开始***/
			//日期时间选择器
			$("#datetimeStart").datepicker({
			    format: "yyyy-mm-dd",
			    autoclose: true,
			    minView: "month",
			    maxView: "decade",
			    todayBtn: true,
			    pickerPosition: "bottom-left"
			}).on("click",function(ev){
			    $("#datetimeStart").datepicker("setEndDate", $("#datetimeEnd").val());
			});
			$("#datetimeEnd").datepicker({
			    format: "yyyy-mm-dd",
			    autoclose: true,
			    minView: "month",
			    maxView: "decade",
			    todayBtn: true,
			    pickerPosition: "bottom-left"
			}).on("click", function (ev) {
			    $("#datetimeEnd").datepicker("setStartDate", $("#datetimeStart").val());
			});
			/**日期的结束***/	

	function froze(id){
		alert(id);
	}
	
	function dynamicSubmit(url) {
		var form = $('.form-search');
		if(url) {
			$(form).attr("action", url);
		}
		$(form).submit();
	}
</script>
</body>
</html>
